// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import axios from "axios"
import App from './App'
import router from './router'
import Login from '@/components/Login'

// import appHeader from '@/components/appHeader'
const routes = [
  { path: '/login', component: Login },
]
// var server_root = 'http://139.196.10.201:7007'; //服务请求的根节点
// var server_url = server_root + '/p2p_test';
// const Login = { template: Login }

Vue.config.productionTip = false;


Vue.prototype.$ajax = axios;
// Vue.prototype.$ajax.defaults.baseURL = "http://172.16.18.113:8086/sh_p2p_bhtz";
Vue.prototype.$ajax.defaults.baseURL = "http://return.binhetouzi.com";
// Vue.prototype.$ajax.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';

/* eslint-disable no-new */
const app = new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
}).$mount('#app')

router.beforeEach((to, from, next) => {
  // alert(sessionStorage.getItem('accessToken'))
  if ((to.path != '/login') && (!localStorage.getItem('memberId') || localStorage.getItem('memberId') == 'undefined')) {
    next({
      path: '/login'
    })
  } else {
    next()
  }
})